<template>
  <view class="page">
  
    <view>
      <zzx-calendar class="bottom-box" :showBack="true" @selected-change="datechange" ></zzx-calendar>
    </view>

    <view v-if="current == 0"  class="content">
      <red-empty img="record" bg="#f6f7f8" text="暂无记录" imgSize="640rpx" height="85.5vh" />
 
    </view>
    <view v-else class="content">
      <u-gap height="25" bg-color="#f5f5f5" ></u-gap>
      <cc-listView :productList="courseList" >
        
   
      </cc-listView>
     
    </view>
 
    
    
  </view>
</template>

<script>
  import zzxCalendar from "@/components/zzx-calendar/zzx-calendar.vue"
  export default {
    components: {
      zzxCalendar,
    },
    data() {
      return {
        claDate: '',
        courseList: '',
        current: 0,
        productList : '',
        flag : false,
      }
    },
    onLoad() {
      
      // 获取当前日期
      var currentDate = new Date();
      // 格式化日期
      var year = currentDate.getFullYear();
      var month = ('0' + (currentDate.getMonth() + 1)).slice(-2); // 月份从 0 开始，所以要加 1
      var day = ('0' + currentDate.getDate()).slice(-2);
      var today = year + '-' + month + '-' + day;
      this.$u.api.searchListForTeacherId({
        teacherId: this.vuex_teacherId,
        claDate: today
      }).then(response => {
        if (response.code == 200) {
          if (response.data == '') {
            this.current = 0
          } else {
            this.courseList = response.data
            
          
            this.current = 1
          }
        } else {
          uni.showToast({
            title: '服务器出错',
            icon: 'error'
          })


        }
      })
    },




    methods: {

      datechange(e) {
        this.$u.api.searchListForTeacherId({
          teacherId: this.vuex_teacherId,
          claDate: e.fulldate
        }).then(response => {
          if (response.code == 200) {
            if (response.data == '') {
              this.current = 0
            } else {
              this.courseList = response.data
              this.current = 1
            }
          } else {
            uni.showToast({
              title: '服务器出错',
              icon: 'error'
            })


          }
        })
      }
    }
  }
</script>

<style lang="scss" >
 page {
   
   background-color: #f8f8f8; /* 设置页面的背景色为浅灰色 */
 }
  .content {
    margin-top: 180rpx;
    // position: fixed;
    // padding-top: 175rpx;
    //  line-height: 50px;
    // display: flex;
    // flex-direction: column;
    // align-items: center;
    // justify-content: center;
  }
  .zzx-calendar {
    top: 0%;
    z-index: 99;
    position: fixed;
    }
    
    
    .background{
    	background-color: #f7f7f7;
    	width: 100vw;
    	// min-height: calc(100vh - 100rpx);
    	/* #ifdef H5 */
    	min-height: 70vh;
    	/* #endif */
    	/* #ifndef H5 */
    	min-height: 100vh;
    	/* #endif */
    	padding-top: 1rpx;
    	
    	.filter{
    		background: #fff;
    		padding: 30rpx;
    		width: 100vw;
    		overflow-x:scroll;
    		.filter-item{
    			min-width: 200rpx;
    			height: 80rpx;
    			background: #F4F6F9;
    			border-radius: 20px;
    			background: #F4F6F9;
    			background-size: 39rpx 30rpx;
    			margin-right: 20rpx;
    			
    			font-size: 32rpx; 
    			color: #7F8BB4;
    			font-weight: 400;
    			
    			image{
    				width: 33rpx;
    			}
    		}
    	}
    }
    

</style>